package com.yuan.aicodemother.controller;

import com.yuan.aicodemother.annotation.AuthCheck;
import com.yuan.aicodemother.common.BaseResponse;
import com.yuan.aicodemother.common.ResultUtils;
import com.yuan.aicodemother.exception.BusinessException;
import com.yuan.aicodemother.exception.ErrorCode;
import com.yuan.aicodemother.model.dto.user.UserAddRequest;
import com.yuan.aicodemother.service.UserService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "管理员用户管理")
@RestController
@RequestMapping("/adminUser")
public class AdminController {

    @Autowired
    private UserService userService;

    @AuthCheck
    @PostMapping("/add")
    public BaseResponse<Boolean> addUser(@RequestBody UserAddRequest userAddRequest){
        if (userAddRequest == null){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"参数为空");
        }
        return ResultUtils.success(userService.addUser(userAddRequest));
    }
}
